package com.jia.lidao.network.http.request.impl;

import com.jia.lidao.Constans;
import com.jia.lidao.network.http.request.AbstractRequest;

import org.apache.http.Header;

import java.lang.reflect.Type;
import java.util.List;

/**
 * Created by jia on 17/12/19.
 */

public class DeliveryRequest extends AbstractRequest {

    private int id, driverId;

    private String phone, name, carNum;

    public DeliveryRequest(int orderid, int driverId, String phone, String name, String carNum) {
        this.id = orderid;
        this.phone = phone;
        this.name = name;
        this.carNum = carNum;
        this.driverId = driverId;
    }


    @Override
    public String getUrl() {
        return Constans.BASEURL + "/orders/" + id + "/delivery";
    }

    @Override
    public void initRequestParams() {
        addParam("order_id", String.valueOf(id));
        if (driverId != 0) {
            addParam("logistics_driver_id", String.valueOf(driverId));
        }
        addParam("realname", name);
        addParam("mobile", phone);
        addParam("license", carNum);
    }

    @Override
    public List<Header> getHeaders() {
        return null;
    }

    @Override
    public Type getResultType() {
        return Void.class;
    }
}
